In the prior art, it has been known to temporarily generate binary data from color or monochromatic gray scale image data for detecting the direction and the angle of the document image as well as for performing character recognition. For example, Japanese Patent Publication Hei 6-068245 discloses a method for detecting the angle of the image after the original image data is converted into binary data. Furthermore, Japanese Patent Publication Hei 10-143608 proposes a binary data generation technique in which original data is digitized or digitized based upon an appropriate threshold value and an average line width is determined. By comparing the average line width to a predetermined range of values, it is determined whether or not the binary data is appropriate for the character recognition process. If it is determined that the binary data is not appropriate, the binarization process takes place again.
The current inventor has proposed the angle detection technique in Japanese Patent Publication Hei 7-105310 and the direction detection technique in Japanese Patent Publication 2000-113103. Furthermore, Japanese Patent 2743378 discloses a technique to determine the background and the characters in the binary data and to convert the characters in black. Japanese Patent Publication Hei 8-249421 discloses a technique for determining a black-white reversal by comparing a black-pixel density characteristic value to a predetermined reversal standard value. The black-pixel density characteristic value is determined by counting the black and white pixels. When the above described techniques are combined, it is possible to detect the skew angle and the direction of the document even though an image with a large number of reversed portions is inputted.
The techniques as disclosed in Japanese Patent Publication Hei 6-068245 and Japanese Patent Publication Hei 10-143608 cannot detect the skew angle or the direction of the document in certain situations where the input data has many black-and-white reversed portions in monochrome data or brightness reversed portions in color data. In color data, the brightness of the background and the characters are reversed as if the black and white portions are reversed in the monochrome data. There are a number of reasons for failing to detect the skew angle and the document direction. For example, to determine the skew angle, no straight line exists in the image data or no character exists in a stable manner. Another example is that a plurality of possible directions exists in the same image such as a character “H” or a number “8.” Similar situations exist with certain Japanese characters such as “, ,.” Another reason for failure is that the white characters are on the black background rather than the other way around.
The techniques of Publication Hei 7-105310 and Japanese Patent Publication 2000-113103 presuppose that characters are written in black on white background. Since characters are extracted by determining minimal circumscribing rectangles for black lines, the above techniques almost certainly fail to obtain the desirable character rectangles for the white characters on the black background. On the other hand, the techniques as disclosed in Japanese Patent 2743378 and Japanese Patent Publication Hei 8-249421 mistakenly recognize the reversal in certain image data despite the white characters on the black background. The erroneous recognition is caused since the black pixels exceed the white pixels in number in certain image data that is obtained by scanning a cutout newspaper article without closing the scanner cover or by taking a digital photo of white characters on the black paper against dark background.
To solve the above described problems, the current invention provides an image processing technique for outputting useful information for character recognition as well as for detecting the tilt angle and the direction of the image document even though the multi-value image is reversed such that the light characters are over the dark background.